//
//  LSTextSlideView.m
//  KuaiYi
//
//  Created by 袁应荣 on 2016/11/13.
//  Copyright © 2016年 HeiMa. All rights reserved.
//

#import "LSTextSlideView.h"
#import <Masonry.h>
#import "UILabel+HMAddition.h"


@implementation LSTextSlideView

- (void)setupSubviews
{
    [super setupSubviews];
    
    // 创建子控件
    UIImageView *lineImgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"yj"]];
    [self addSubview:lineImgView];
    
    UILabel *nameLabel = [UILabel hm_labelWithText:@"名医通" fontSize:21 color:[UIColor blackColor]];
    [self addSubview:nameLabel];
    UIView *scrollView = [[UIView alloc] init];
    scrollView.backgroundColor = [UIColor orangeColor];
    [self addSubview:scrollView];
    
    // 自动布局
    CGSize lineSize = CGSizeMake(6, 20);
    CGFloat margin = 12;
    CGSize scrollSize = CGSizeMake(250, 40);
    [lineImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(self).offset(margin);
        make.size.mas_equalTo(lineSize);
        make.centerY.equalTo(self);
    }];
    [nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.left.equalTo(lineImgView.mas_right).offset(margin);
        make.centerY.equalTo(self);
    }];
    [scrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self);
        make.right.equalTo(self).offset(-margin);
        make.size.mas_equalTo(scrollSize);
    }];
    
}



@end
